home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: [Q] unpack 10 bit data
- Date: Thu, 18 Apr 96 12:44:10 GMT
- Organization: none
- Message-ID: <829831450snz@genesis.demon.co.uk>
- References: <Pine.SGI.3.91.960417231151.16763A-100000@anchor.gsfc.nasa.gov>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <Pine.SGI.3.91.960417231151.16763A-100000@anchor.gsfc.nasa.gov>
- jyli@anchor.gsfc.nasa.gov "Jason Y. Li" writes:
-
- >
- >I am looking for an efficient and elegant way of unpacking 10 bit data.
- >In many scientific applications, raw data are packed into 10 bit data
- >stream. For example, an input buffer of 40 bits (5 characters) contains
- >four 10-bit integers.
-
- Do the high or low order bits for a 10 bit chunk appear first in the
- data stream?
-
- > I know one way of unpacking the data which involves
- >bit masking and then shifting left-and-right. It looks pretty messy to me. I
- >am sure smart folks out there have better ways or ideas. I'd appreciate
- >if you would let me know.
-
- The solution will most likely involve shifting and masking. However there
- may perhaps be a cleaner solution than the one you saw.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-